// JavaScript Document
var etIcon = {};
etIcon.loading = 'loading.gif';
etIcon.tips = 'tips.gif';
etIcon.success = 'success.gif';
etIcon.error = 'error.gif';

var etcommon = {};

//遮罩显示
etcommon.maskShow = function(){
	if($('#loading_mask').length>0){
	}else{
		$('body').append('<div id="loading_mask"></div>');
	}	
	$('#loading_mask').show();
	$('body').css('overflow','hidden');
}
//遮罩隐藏
etcommon.maskHide = function(){
	if($('#loading_mask').length>0){
		$('#loading_mask').remove();
	}
	
	$('body').css('overflow','');
}

var frameApi = frameElement.api, windowApi = frameApi.opener;

//打开窗口函数
function openDialog(id,href,width,height,title,lock){
	windowApi.lhgdialog({
		id:id,
		title:title,
		content: 'url:'+href,
		width:width,
		height:height,
		lock  :lock,
		init: function(){
			windowApi.windowManage();
		},
		close: function(){
			windowApi.$('body').oneTime('100ms',function(){
				windowApi.windowManage();
			});
		}
	});
}

$(function () {
	//隔行换色
	$('.interlaceColor tr:even').addClass("even");//奇数行  
	$('.interlaceColor tr:odd').addClass("odd");//偶数行
	
	//绑定窗口打开事件
	$('.openwin').each(function(index, element) {
		$(this).on('click',function(){
			var id = $(this).attr('id');
			var href = $(this).attr('ehref');
			var width = $(this).attr('ewidth');
			var height = $(this).attr('eheight');
			var title = $(this).attr('etitle');
			
			openDialog(id,href,width,height,title);
		});
	});
	
	//表单布局重置
	function formLayout(){
		if($('.page_wraper').length>0){
			var page_wraper_height = $(window).height()-$('.page_header').height()-7;
			$('.page_wraper').height(page_wraper_height);
		}
	}
	
	$(window).on('resize',function(){
		formLayout();
	});
	
	formLayout();
});